package com.drugstore.drugstore.controller;

import java.util.List;

import com.drugstore.drugstore.domain.Store;
import com.drugstore.drugstore.service.IStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Controller
 * 
 * @author 
 * @date 2025-05-08
 */
@CrossOrigin
@RestController
@RequestMapping("/system/store")
public class StoreController 
{
    @Autowired
    private IStoreService storeService;

    /**
     * 查询列表
     */
    @GetMapping("/list")
    public List<Store> list(Store store)
    {
        return storeService.selectStoreList(store);
    }

    /**
     * 获取详细信息
     */
    @GetMapping(value = "/{id}")
    public Store getInfo(@PathVariable("id") Long id)
    {
        return storeService.selectStoreById(id);
    }

    /**
     * 新增
     */
    @PostMapping
    public int add(@RequestBody Store store)
    {
        return storeService.insertStore(store);
    }

    /**
     * 修改
     */
    @PutMapping
    public int edit(@RequestBody Store store)
    {
        return storeService.updateStore(store);
    }

    /**
     * 删除
     */
	@DeleteMapping("/{ids}")
    public int remove(@PathVariable Long[] ids)
    {
        return storeService.deleteStoreByIds(ids);
    }
}
